/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.corpus;

import view.controller.corpus.ControllerAddCorpus;

/**
 *
 * @author Djordje Gligorijevic
 */
public class FrmAddCorpus extends javax.swing.JDialog {
    private ControllerAddCorpus controllerAddKorpus;
    /**
     * Creates new form FrmAddkorpus
     */
    public FrmAddCorpus(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        txtFKorpusName = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtAKorpusDescription = new javax.swing.JTextArea();
        jToggleButton1 = new javax.swing.JToggleButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setText("Korpus name");

        jLabel2.setText("Korpus description");

        txtAKorpusDescription.setColumns(20);
        txtAKorpusDescription.setRows(5);
        jScrollPane1.setViewportView(txtAKorpusDescription);

        jToggleButton1.setText("Add corpus");
        jToggleButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2))
                .addGap(24, 24, 24)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtFKorpusName)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jToggleButton1)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtFKorpusName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jToggleButton1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed
//        Corpus corpus = new Corpus();
//        corpus.setCorpusName(getTxtFKorpusName().getText().trim());
//        corpus.setCorpusDescription(getTxtAKorpusDescription().getText().trim());
            getControllerAddKorpus().addNewCorpus();
//            JOptionPane.showMessageDialog(this, "Your korpus has been successfully added.");
            getTxtAKorpusDescription().setText("");
            getTxtFKorpusName().setText("");
    }//GEN-LAST:event_jToggleButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrmAddCorpus.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrmAddCorpus.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrmAddCorpus.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrmAddCorpus.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                FrmAddCorpus dialog = new FrmAddCorpus(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JToggleButton jToggleButton1;
    private javax.swing.JTextArea txtAKorpusDescription;
    private javax.swing.JTextField txtFKorpusName;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the controllerAddKorpus
     */
    public ControllerAddCorpus getControllerAddKorpus() {
        return controllerAddKorpus;
    }

    /**
     * @param controllerAddKorpus the controllerAddKorpus to set
     */
    public void setControllerAddKorpus(ControllerAddCorpus controllerAddKorpus) {
        this.controllerAddKorpus = controllerAddKorpus;
    }

    /**
     * @return the jLabel1
     */
    public javax.swing.JLabel getjLabel1() {
        return jLabel1;
    }

    /**
     * @param jLabel1 the jLabel1 to set
     */
    public void setjLabel1(javax.swing.JLabel jLabel1) {
        this.jLabel1 = jLabel1;
    }

    /**
     * @return the jLabel2
     */
    public javax.swing.JLabel getjLabel2() {
        return jLabel2;
    }

    /**
     * @param jLabel2 the jLabel2 to set
     */
    public void setjLabel2(javax.swing.JLabel jLabel2) {
        this.jLabel2 = jLabel2;
    }

    /**
     * @return the jScrollPane1
     */
    public javax.swing.JScrollPane getjScrollPane1() {
        return jScrollPane1;
    }

    /**
     * @param jScrollPane1 the jScrollPane1 to set
     */
    public void setjScrollPane1(javax.swing.JScrollPane jScrollPane1) {
        this.jScrollPane1 = jScrollPane1;
    }

    /**
     * @return the jToggleButton1
     */
    public javax.swing.JToggleButton getjToggleButton1() {
        return jToggleButton1;
    }

    /**
     * @param jToggleButton1 the jToggleButton1 to set
     */
    public void setjToggleButton1(javax.swing.JToggleButton jToggleButton1) {
        this.jToggleButton1 = jToggleButton1;
    }

    /**
     * @return the txtAKorpusDescription
     */
    public javax.swing.JTextArea getTxtAKorpusDescription() {
        return txtAKorpusDescription;
    }

    /**
     * @param txtAKorpusDescription the txtAKorpusDescription to set
     */
    public void setTxtAKorpusDescription(javax.swing.JTextArea txtAKorpusDescription) {
        this.txtAKorpusDescription = txtAKorpusDescription;
    }

    /**
     * @return the txtFKorpusName
     */
    public javax.swing.JTextField getTxtFKorpusName() {
        return txtFKorpusName;
    }

    /**
     * @param txtFKorpusName the txtFKorpusName to set
     */
    public void setTxtFKorpusName(javax.swing.JTextField txtFKorpusName) {
        this.txtFKorpusName = txtFKorpusName;
    }
}
